<?php

namespace Biz\module\Classes\adm;


/**
 * Class StoreContentSearch
 * @package Biz\module\Classes\adm
 */
class StoreContentSearch
{
    public $store_id = null; // 门店id
    public $keyword = ""; // 搜索词
    public $content_type = []; // 内容类型 [2 => '文章',3 => '图片',4 => '视频',]
    public $content_module = null; // 功能模块 1 住友说 2 设计师说 3 门店动态
    public $content_status = null; // 内容状态 1 已收录 2 取消收录 3 删除 4 关联删除
    public array $created_time_range = []; // 发布日期 时间戳
    public $page = 1;
    public $page_size = 20;
    public $sort = "default"; //default 默认  addtime 发布时间   created_at 后台使用
    public $desc = "desc"; //asc desc 默认desc
    public $is_top = null; // 1为需要置顶  按照top_time逆向排序

    public $current_time = null; // 当前时间
    public $search_keywords = []; // 检索词
    public $filter_owner_uid = []; //过滤

    public function __construct($params)
    {
        if(!empty($params['store_id'])) $this->store_id = $params['store_id'];

        if(!empty($params['keyword'])) $this->keyword = $params['keyword'];

        if(!empty($params['content_type'])) $this->content_type = $params['content_type'];

        if(!empty($params['content_module'])) $this->content_module = $params['content_module'];

        if(!empty($params['content_status'])) $this->content_status = $params['content_status'];

        if(!empty($params['created_time_range']['start'])) $this->created_time_range['start'] = $params['created_time_range']['start'];

        if(!empty($params['created_time_range']['end'])) $this->created_time_range['end'] = $params['created_time_range']['end'];

        if(isset($params['page'])) $this->page = abs($params['page']) ? abs($params['page']) : $this->page;

        if(isset($params['per_page'])) $this->page_size = $params['per_page'];

        if(!empty($params['desc'])) $this->desc = $params['desc'];

        if(!empty($params['sort'])) $this->sort = $params['sort'];

        if (!empty($params['is_top'])) $this->is_top = $params['is_top'];
    }
}